import axios from "../utils/axios";

//获取所有菜单
const menuAllApi = async () => {
  const data = await axios({
    url: "/menu/all",
    method: "get",
  });
  return data;
};
//修改菜单
const menueditApi = async (_data: {
  id: number;
  name: string;
  perms: string;
  path: string;
  component: string;
  parentId: number;
  type: number | string;
}) => {
  const data = await axios({
    url: "/menu/update",
    method: "post",
    data: _data,
  });
  return data;
};
//添加菜单
const menuAddApi = async (_data: {
  component: string;
  name: string;
  parentId: number;
  path: string;
  perms: string;
  type:0
}) => {
  const data = await axios({
    url: "/menu/add",
    method: "post",
    data: _data,
  });
  return data;
};
//删除菜单
const menuDelApi = async (id:number) => {
    const data = await axios({
      url: "/menu/delete/"+id,
      method: "get",
    });
    return data;
  };
export { menuAllApi, menueditApi, menuAddApi,menuDelApi };
